<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>属性监听</title>
        <script src="https://unpkg.com/vue@3.5.13"></script>
    </head>
    <body>
        <div id="Application">
            <input v-model="searchText">
        </div>
        <script>
            const Application = {
                data() {
                    return {
                        searchText: ""
                    }
                },
                watch: {
                    searchText(oldValue, newValue) {
                        if (newValue.length >10){
                            alert("文本太长了")
                        }
                    }
                }
            }
            Vue.createApp(Application).mount('#Application')
        </script>
    </body>
</html>